home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
lisp
/
kcl
/
kcl.lha
/
attport
/
kcn.c
< prev
next >
Wrap
C/C++ Source or Header
|
1986-03-11
|
711b
|
41 lines
#define KCL_SELF "/usr2/kcl/attport/saved_kcn"
#define SYSTEM_DIRECTORY "/usr2/kcl/attport/"
#include <stdio.h>
#include <signal.h>
#define COMSIZ 1024
main()
{
int in[2];
int out[2];
char command[COMSIZ];
char buf[4];
pipe(in);
pipe(out);
if (in[1] != 4 || out[0] != 5) {
fprintf(stderr, "Can't get a pipe.\n");
exit(1);
}
fflush(stdout);
if (fork() != 0) {
close(in[0]);
close(out[1]);
if (execl(KCL_SELF, KCL_SELF, SYSTEM_DIRECTORY, 0) < 0) {
fprintf(stderr, "Can't exec KCL.\n");
exit(1);
}
}
signal(SIGINT, SIG_IGN);
close(in[1]);
close(out[0]);
for (;;) {
if (read(in[0], command, COMSIZ) <= 0)
exit(0);
buf[0] = system(command);
write(out[1], buf, 1);
}
}